package gui;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class ImageChooser {

	String[] filePaths;
	JPanel imagePanel;
	
	public ImageChooser(){
		filePaths = new String[0];
	}
	
	public ImageChooser(String[] filePaths, JPanel imagePanel){
		this.filePaths = filePaths;
		this.imagePanel = imagePanel;
	}
	
	/**
	 * displays the image with the filepath index given by the parameter
	 * @param index - index of the picture's filepath in filePaths
	 */
	public void displayImage(int index){
		if(imagePanel.getComponents().length > 0)
			imagePanel.remove(0);
		ImageIcon image = new ImageIcon(filePaths[index]);
		JLabel imageHolder = new JLabel(image);
		imagePanel.add(imageHolder);		
	}
}
